home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MPW_TOOL
/
TOOLS
/
TOOLS_WI
/
ICON_8
/
MEMMON_F
/
MKSYM.ICN
< prev
next >
Wrap
Text File
|
1990-03-02
|
1KB
|
40 lines
# Icon program to preprocess color symbol and label definitions into C
record colr (sym, char, label)
procedure main ()
colors := []
err := 0
ws := ' \t'
while line := read () do line ? {
tab (many (ws))
if ="#" | pos (0) then next # skip comment line
sym := tab (upto (ws) | 0)
tab (many (ws))
char := tab (upto (ws) | 0)
tab (many (ws))
label := tab (upto (ws) | 0)
if *label > 0 then
put (colors, colr (sym, char, label))
else {
write (&errout, "bad input:\t", line)
err +:= 1
}
}
if err > 0 then
stop ("output suppressed due to input errors")
write ("/* created mechanically -- DO NOT EDIT */")
write ()
write ("#ifndef NColors");
every i := 1 to *colors do
write ("#define ", left (colors[i].sym, 12), right (i-1, 3))
write ("#define NColors ", *colors)
write ("#endif\t\t\t\t/* NColors */");
write ()
write ("#ifdef Color");
every i := 1 to *colors do
write ("Color(",colors[i].sym,",",colors[i].char,",",colors[i].label,")")
write ("#endif\t\t\t\t/* Color */");
end